/**
 * Created by zhourh on 2018/6/14.
 */
public class ListNode {

    int val;

    ListNode next;

    ListNode(int x) { val = x; }

    @Override
    public String toString() {
        StringBuilder stringBuilder = new StringBuilder("[" + val);
        ListNode node = next;
        while (node != null) {
            stringBuilder.append(",").append(node.val);
            node = node.next;
        }

        stringBuilder.append("]");
        return stringBuilder.toString();
    }
}
